<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>确认订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="full-screen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta name="format-detection" content="telephone=no"/>
    <meta name="format-detection" content="address=no">
    <script src="../../js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript">
        var docEl = document.documentElement;
        var clientWidth = docEl.clientWidth;
        docEl.style.fontSize = (clientWidth / 10) + 'px';
        $(document).ready(function () {
            (function (doc, win) {
                var docEl = doc.documentElement,
                        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                        recalc = function () {
                            var clientWidth = docEl.clientWidth;
                            docEl.style.fontSize = (clientWidth / 10) + 'px';
                        };

                if (!doc.addEventListener) return;
                win.addEventListener(resizeEvt, recalc, false);
                doc.addEventListener('DOMContentLoaded', recalc, false);
            })(document, window);
        });
    </script>
    <link rel="stylesheet" href="../../style/css/index.css"/>
</head>
<body>
<div style="background: #f7f7f7;width: 100%;height: 100%">
    <!--header-->
    <div class="header">
        <img class="back" onclick="history.go(-1);" src="../../style/images/sg_ic_back.png" alt=""/>

        <p class="orderName">确认订单</p>
    </div>
    <!-- content-->
    <div class="contactWay">
        <img class="icon_address" src="../../style/images/sg_ic_address.png" alt=""/>

        <div class="phone">
            <span class="name" id="name">巩新华</span>
            <span class="phNum" id="tel">13558768774</span>
        </div>
        <p class="address" id="address">浙江省杭州市上城区中豪望江国际1幢624</p>
        <img class="icon_next" src="../../style/images/mmh_ic_into_1.png" alt=""/>
    </div>

    <div class="contactWay" id="good_list">
        <!--<div style="width: 100%;margin-bottom: 10px;">-->
        <!--<img class="food_pic" src="" alt="" id="image"/>-->
        <!--<div class="food_name">-->
        <!--<p id="title"></p>-->
        <!--<span class="price" id="price"></span>-->
        <!--<span style="float:right;font-size: 12px;margin-top: 0.5rem;color: #999;">x1</span>-->
        <!--</div>-->
        <!--<div class="clear"></div>-->
        <!--</div>-->
    </div>

    <!--<div class="contactWay">-->
    <!--<span class="favorable">优惠卷</span>-->
    <!--<span class="favorable_num">优惠￥20</span>-->
    <!--<img class="red_next" src="../../style/images/mmh_ic_into_3.png" alt=""/>-->
    <!--<div class="clear"></div>-->
    <!--</div>-->

    <div class="contactWay">
        <span class="favorable">配送时间</span>
        <span class="favorable_num" style="margin-right: 15px;color:#999;">尽快送达</span>

        <div class="clear"></div>
    </div>
    <div class="contactWay">
        <ul class="detail">
            <li>
                <span class="favorable" id="orderNum"></span>
            </li>
            <li>
                <span class="favorable" id="orderTime">下单时间：2014-12-31 14:22:23</span>
            </li>
            <li>
                <span class="favorable">订单状态：</span>
                <span style="color: #ff2640;font-size: 12px;float: left;" id="status">待付款</span>
            </li>
        </ul>
    </div>

    <div class="contactWay">

    </div>

</div>
<!--footer-->
<div class="footer">
    <!-- <span>合计：</span>
    <span style="font-size: 18px;margin: 5px;">￥89</span>

    <div class="pay">去结算</div> -->
</div>
<script src="../../js/md5.js"></script>
<script src="../../js/md5_need.js"></script>
<script src="../../js/queryString.js"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        var indexJs = {
            getfruit: function () {
                var data = {
                    apiCode: '_login_001',
                    username: 18368169357,
                    loginPass: 123456
                };
                http(data, function (responed) {
                    var $info = responed.info;
                    var $userToken = $info.userToken;
                    window.localStorage.setItem("userToken", $userToken);
                })
            },
            getmoney: function () {
                var data = {
                    apiCode: '_order_001',
                    type: "2",
                    good_info: '[{"good_id":"113","count":"2","price":"123","type":"2"}]', //将多个商品合并成一个数组传过来
                    amount: '12',
                    userToken: window.localStorage.getItem("userToken")
                };
                http(data, function (responed) {
                    // console.log(responed);
                    var $info = responed.info;
                    $("#orderNum").append("订单编号：" + $info.order_no + "")
                })
            },
            getDefaultReceipt: function () {
                http({
                    apiCode: '_default_receipt_001',
                    userToken: window.localStorage.getItem("userToken")
                }, function (respond) {
                    var info = respond.info;
                    document.getElementById("name").innerText = info.username;
                    document.getElementById("tel").innerText = info.phone;
                    document.getElementById("address").innerText = info.province + info.city + info.area + info.address;
                })
            },
            getInvestInfo: function () {
                http({
                    apiCode: '_invest_info_001',
                    id: QueryString.id, //订单id
                    userToken: window.localStorage.getItem("userToken"),
                    type: QueryString.type
                }, function (respond) {
                    console.log(respond);
                    var $info = respond.info;
                    var $goodlist = $info.goodlist;
                    var temp = '';
                    var good_all = 0;
                    $.each($goodlist, function (i, n) {
                        temp += '<div style="width: 100%;margin-bottom: 10px;">';
                        temp += '<img class="food_pic" src="' + n.img_path + '" alt="" id="image"/>';
                        temp += '<div class="food_name">';
                        temp += '<p id="title">' + n.good_name + '</p>';
                        temp += '<span class="price" id="price">￥' + n.min_price + '</span>';
                        temp += '<span style="float:right;font-size: 12px;margin-top: 0.5rem;color: #999;">x' + n.count + '</span>';
                        temp += '</div>';
                        temp += '<div class="clear"></div>';
                        temp += '</div>';
                        good_all += n.min_price;
                    });
                    $("#good_list").append(temp);
                    if (QueryString.type == (2 || 5)) {
                        var temp = '';
                        temp += '<span>合计：</span>';
                        temp += '<span style="font-size: 18px;margin: 5px;" id="last_price">￥89</span>';
                        temp += '<div class="pay"><a href="pay.html?good_all=' + good_all + '">去结算</a></div>';
                        $("#footer").append(temp);
                    } else {
                        var temp = '';
                        temp += '';
                        temp += '<div class="pay" style="background:#ff2640;"><a href="#">取消订单</a></div>';
                        temp += '<div class="pay"><a href="obligation.html">立即支付</a></div>';
                        $("#footer").append(temp);
                    }
                    $("#postage").html("￥" + $info.postage);
                    $("#discount_amount").html("￥" + $info.coupon_info.discount_amount);
                    $("#good_all").html("￥" + good_all);
                    $("#last_price").html("￥" + (parseInt(good_all) + parseInt($info.coupon_info.discount_amount) - parseInt($info.postage)));
                    $("#youhui").html("优惠￥" + $info.postage);
                })
            }
        };
        indexJs.getfruit();
        indexJs.getmoney();
        indexJs.getDefaultReceipt();
//        indexJs.getGoodsInfo();
        indexJs.getInvestInfo();
//        window.onload =indexJs.getmoney();
    });
</script>
</body>
</html>